package com.huawei.itemservice.mapper;

import com.huawei.itemservice.pojo.entity.Item;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ItemMapper {

    @Insert("insert into douyue.item (id, name, price, image, description, create_time, update_time, create_user) " +
            "values (#{id},#{name},#{price},#{image},#{description},#{createTime},#{updateTime},#{createUser})")
    void createItem(Item item);





    void updateItem(Item item);


    @Update("update douyue.item set status=0 where id=#{id}")
    void deleteItem(Long id);

    @Select("select * from douyue.item where id=#{id}")
    Item getItemById(Long id);


    @Select("select id from douyue.item where create_user=#{id}")
    List<Long> findAllItems(Long id);


    @Select("select id from douyue.item where create_user=#{id}")
    List<Long> getAllItems(Long id);
}
